package br.ufc.si.config;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import org.hibernate.Session;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 * Hibernate Utility class with a convenient method to get Session Factory object.
 *
 * @author Am1b10s
 */
public class HibernateUtil {

    	private static SessionFactory factory;
	static {
	Configuration configuration = new AnnotationConfiguration();
	configuration.configure("/br/ufc/si/config/hibernate.cfg.xml");
	factory = configuration.buildSessionFactory();
	}
	public static Session getSession() {
	return factory.openSession();
	}
}
